package com.shallowUniverse.dmp.utils;

import com.shallowUniverse.dmp.entity.Result;

/**
 * @author Shuai Guo
 * @version 1.0
 * @description
 * @date 2021/8/5
 */
public class ResultTool {

    public static <T> Result<T> success(T data, String msg) {
        return new Result<T>(data).setMsg(msg).setCode(200);
    }

    public static <T> Result<T> success(T data) {
        return new Result<T>(data).setCode(200);
    }

    public static <T> Result<T> success(String msg) {
        return new Result<T>().setMsg(msg).setCode(200);
    }

    public static <T> Result<T> success() {
        return new Result<T>().setCode(200);
    }

    public static <T> Result<T> fail(String msg) {
        return new Result<T>().setMsg(msg).setCode(500);
    }

    public static <T> Result<T> fail() {
        return new Result<T>().setCode(500);
    }
}
